package org.jetlinks.pro.standalone.configuration;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@Slf4j
public class JetLinksConfiguration {

    @Bean
    public WebServerFactoryCustomizer<NettyReactiveWebServerFactory> webServerFactoryWebServerFactoryCustomizer() {
        //解决请求参数最大长度问题
        return factory -> factory
            .addServerCustomizers(httpServer -> httpServer
                .httpRequestDecoder(spec -> {
                    spec.maxInitialLineLength(10240);
                    spec.maxHeaderSize(10240);
                    return spec;
                }));
    }



}
